package com.caojin.propertyInjector;

import java.util.HashMap;
import java.util.Map;
import java.util.Properties;
import com.caojin.util.PropertiesUtil;

/**
 * 配置信息的缓存
 * @author caojin
 */
public class PropertiesCache {
	private static Map<String, Properties> propCache = new HashMap<String, Properties>();

	public static Properties getProperties(String filePath) {
		return propCache.get(filePath);
	}

	public static void putProperties(String filePath, Properties properties) {
		propCache.put(filePath, properties);
	}

	public static void putProperties(String filePath) {
		if (propCache.get(filePath) != null
				&& propCache.get(filePath).size() != 0) {
			return;
		}
		putProperties(filePath, PropertiesUtil.loadProperties(filePath));
	}

}
